package GUI;

import interpreter.ShapeBase;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;

import composite.DocumentManager;

/** Panel to group all panels with buttons */
@SuppressWarnings("serial")
public class ButtonsPanel extends JPanel {
	ShapesPanel shapesPanel;
	EditPanel editPanel; 
	

	public ButtonsPanel(ShapeBase shapeBase, DocumentManager docuMan){
		setLayout(new GridLayout(0, 1));
		ModePanel modePanel 	= new ModePanel(this);
		shapesPanel 			= new ShapesPanel(shapeBase);
	    editPanel 				= new EditPanel();
	    editPanel.setVisible(false);
		FuncPanel funcPanel 	= new FuncPanel(docuMan);
		
		shapesPanel.setVisible(true);
		
		add(shapesPanel);
		add(editPanel);
		add(modePanel);
		add(funcPanel);
	}
	
	public class ModePanelActionListener implements ActionListener {
	   /** Listens to the radio button change. */
		public void actionPerformed(ActionEvent e) {
			ModePanel.currentMode = e.getActionCommand();
			
			if(ModePanel.currentMode == "Edit"){
				shapesPanel.setVisible(false);
				editPanel.setVisible(true);
			}
			else if (ModePanel.currentMode == "Draw"){
				shapesPanel.setVisible(true);
				editPanel.setVisible(false);
			}
		}
	}
 
}
